<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title></title>
</head>

<body>
    <img src="./img/图片切换/1.jpg" id="img_src"><br />
    <button type="button" onclick="img(event)">开始</button>
</body>
<script type="text/javascript">
    // 随机打印
    function img_bh1(event) {
        var img_src = document.getElementById('img_src')
        setInterval(function() {
            var num = sj();
            img_src.src = "./img/图片切换/" + num + ".jpg";
        }, 100)
    }

    function sj() {
        var Num = 0;
        while (true) {
            Num = Math.floor(Math.random() * 10);
            if (Num != 0) {
                break;
            }
        }
        return Num;
    }

    function img(event) {
        var img_src = document.getElementById('img_src')
        var num = 2;
        setInterval(function() {
            img_src.src = "./img/图片切换/" + num + ".jpg";
            num++;
            console.log(num)
            if (num != 0) {
                break;
            }
        }, 100)
    }
</script>

</html>